package com.example.mweather.beans;

import java.util.ArrayList;
import java.util.List;

public class HourlyItemBean {
    private String time;
    private String skycon;
    private String temp;

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getSkycon() {
        return skycon;
    }

    public void setSkycon(String skycon) {
        this.skycon = skycon;
    }

    public String getTemp() {
        return temp;
    }

    public void setTemp(String temp) {
        this.temp = temp;
    }

    public HourlyItemBean(String time, String skycon, String temp) {
        this.time = time;
        this.skycon = skycon;
        this.temp = temp;
    }

    public static List<HourlyItemBean> getList(WeatherHourly weatherHourly) {
        List<HourlyItemBean> list = new ArrayList<>();
        for (int i = 0; i < weatherHourly.getResult().getHourly().getTemperature().size(); i++) {
            String time = weatherHourly.getResult().getHourly().getTemperature().get(i).getDatetime().substring(11, 16);
            String skycon = weatherHourly.getResult().getHourly().getSkycon().get(i).getValue();
            String temp = (int) weatherHourly.getResult().getHourly().getTemperature().get(i).getValue() + "\u00AD°C";
            list.add(new HourlyItemBean(time, skycon, temp));
        }
        return list;
    }
}
